package com.easyattendance.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="tbl_StudentLeave")
@IdClass(StudentLeavePK.class)
public class StudentLeave {

	@Id
	@GenericGenerator(name="stud_roll_no",strategy="foreign")
	@Column(name="stud_roll_no",length=3,nullable=false)
	private int stud_roll_no;
	
	@Id
	@Column(name="class_id",length=15,nullable=false)
	private String class_id;
	
	@Id
	@Column(name="leave_start_date",nullable=false)
	private Date leave_start_date;
	
	@Column(name="leave_end_date")
	private Date leave_end_date;
	
	@Column(name="reason_for_leave",length=255,nullable=false)
	private String reason_for_leave;
	
	

	public String getClass_id() {
		return class_id;
	}

	public void setClass_id(String class_id) {
		this.class_id = class_id;
	}

	public Date getLeave_start_date() {
		return leave_start_date;
	}

	public void setLeave_start_date(Date leave_start_date) {
		this.leave_start_date = leave_start_date;
	}

	public Date getLeave_end_date() {
		return leave_end_date;
	}

	public void setLeave_end_date(Date leave_end_date) {
		this.leave_end_date = leave_end_date;
	}

	public String getReason_for_leave() {
		return reason_for_leave;
	}

	public void setReason_for_leave(String reason_for_leave) {
		this.reason_for_leave = reason_for_leave;
	}

	
	public StudentLeave()
	{
		
	}
	
	public StudentLeave(int stud_roll_no,Date leave_start_date, Date leave_end_date, String reason_for_leave) {
		super();
		this.stud_roll_no = stud_roll_no;
		this.leave_start_date = leave_start_date;
		this.leave_end_date = leave_end_date;
		this.reason_for_leave = reason_for_leave;
	}

	public StudentLeave(int stud_roll_no, String class_id,Date leave_start_date, Date leave_end_date,
			String reason_for_leave) {
		super();
		this.stud_roll_no = stud_roll_no;
		this.class_id = class_id;
		this.leave_start_date = leave_start_date;
		this.leave_end_date = leave_end_date;
		this.reason_for_leave = reason_for_leave;
	}
	

	public StudentLeave(int stud_roll_no) {
		super();
		this.stud_roll_no = stud_roll_no;
	}

	@ManyToOne
	@JoinColumns({
	@JoinColumn(name="stud_roll_no",referencedColumnName="stud_roll_no",insertable=false,updatable=false),
	@JoinColumn(name="class_id",referencedColumnName="class_id",insertable=false,updatable=false)
	})
	Student student;

	

	public int getStud_roll_no() {
		return stud_roll_no;
	}

	public void setStud_roll_no(int stud_roll_no) {
		this.stud_roll_no = stud_roll_no;
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}


	
	
	
	/* @ManyToOne
	 @JoinColumn(name="class_id",referencedColumnName="class_id",insertable=false,updatable=false)
	 private Class classes; */
	
	
	
}
